package com.example.tld;

import java.io.IOException;
import java.util.List;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.SimpleTagSupport;

public class MenuTLD extends SimpleTagSupport {

	private List<String> menus;
	private String var;

	public void setMenus(List<String> Menus) {
		this.menus = Menus;
	}

	public List<String> getMenus() {
		return menus;
	}

	public void setVar(String var) {
		this.var = var;
	}

	public String getVar() {
		return var;
	}

	@Override
	public void doTag() throws JspException, IOException {

		JspWriter writer = getJspContext().getOut();
		if (menus == null) {
			writer.print("<tr>");
			writer.print("<td>" + "no string" + "</td>");
			writer.print("</tr>");
		} else {
			for (String menu : menus) {
				writer.print("<tr>");
				writer.print("<td><li>" + menu + "</li></td>");
				writer.print("</tr>");
			}
		}
	}

}
